<template>
  <div>
<h1>插槽</h1>
<GuanLi>
  <template v-slot="data">
    <input type="button" value="删除" @click="del(data)">
  </template>
</GuanLi>
  </div>
</template>

<script setup lang="ts">
import GuanLi from './GuanLi.vue'
import axios from 'axios'
import { useRoute,useRouter } from 'vue-router';
const router=useRouter()
const route=useRoute()

const del=(data:any)=>{
const f=confirm('确认删除吗？')
if(f){
  axios({
    url:'/api/Users/GetDel',
    method:'get',
    params:{
      Iid:data.data
    }
  })
  .then(res=>{
    if(res.data.data>0){
      alert('删除成功');
      router.go(0);
    }
    else if(res.data.data==-1){
      alert('有人投资不能删除');
      return;
    }
    else{
      alert('删除失败');
      return;
    }
  })
}
}
</script>

<style scoped>

</style>